package md.mru.core.repositories;

import md.mru.core.domains.administration.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author sergiu.marin
 * @since 16.04.2014.
 */
public interface UserRepository extends JpaRepository<User, Long> {

    @Query("SELECT u FROM User u WHERE u.email=:email")
    User loadUserByUsername(@Param("email") String username);

    @Query("SELECT u FROM User u WHERE not u.id=:id")
    List<User> getAllUsers(@Param("id") long id);
}
